{% extends "cms/cms_base.html" %}

{% block title %}
    帖子管理页面
{% endblock %}

{% block page_title %}
    {{ self.title() }}
{% endblock %}

{% block head %}
    <script src="{{ static('cms/js/cms_post.js') }}"></script>
{% endblock %}

{% block main_context %}
    <table class="table table-bordered">
        <tr>
            <td>标题</td>
            <td>发布时间</td>
            <td>板块</td>
            <td>作者</td>
            <td>操作</td>
        </tr>
        <tbody>
        {% for post in posts %}
            <tr data-post-id="{{ post.id }}"  data-high-tag="{{ 1 if post.highlight else 0 }}">
                <td>{{ post.title }}</td>
                <td>{{ post.create_time }}</td>
                <td>{{ post.board.name }}</td>
                <td>{{ post.author.username }}</td>
                <td>
                    {% if not post.highlight %}
                        <button class="btn btn-default btn-sm post-btn">加精</button>
                    {% else %}
                        <button class="btn btn-default btn-sm post-btn">取消加精</button>
                    {% endif %}

                    <button class="btn btn-danger btn-sm">删除</button>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock %}